package com.ebt.m.proposal_v2.dao.request;

import com.ebt.m.proposal_v2.base.Constant;
import com.ebt.m.proposal_v2.utils.DataUtils;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 参数 -> 根据品牌请求产品
 *
 * @author archer.qi
 *         Created on 2017/5/24.
 */
public class ParamBrandProducts implements Serializable {

    public int brandId;
    public String brandShortName;

    public String age;
    public int sex;
    public int profession;
    public String birthday;

    // 0 = 附加险， 1 = 主险， 2 = 独立险种
    // 这里请求主险，设定为1
    public final int contractProperty = 1;
    // 4代表主险时请求
    public final int from = 4;

    public int page = 1;
    public String pageSize = Constant.DEFAULT_PAGE_SIZE + "";

    public int companyId;
    public String keyword;

    public Map<String, String> createParamMap() {
        Map<String, String> param = new HashMap<>();
        param.put("brandId", brandId + "");
        param.put("brandShortName", brandShortName);
        param.put("contractProperty", contractProperty + "");
        param.put("from", from + "");
        param.put("age", DataUtils.formatRequestParamAge(age, birthday));
        param.put("sex", sex + "");
        param.put("profession", profession + "");
        param.put("page", page + "");
        param.put("pageSize", pageSize);
        return param;
    }

    /**
     * 搜索产品参数
     *
     * @return
     */
    public Map<String, String> createSearchParamMap() {
        Map<String, String> param = new HashMap<>();
        param.put("keyword", keyword);
        param.put("contractProperty", contractProperty + "");
        param.put("from", from + "");
        param.put("age", DataUtils.formatRequestParamAge(age, birthday));
        param.put("sex", sex + "");
        param.put("profession", profession + "");
        param.put("page", page + "");
        param.put("pageSize", pageSize);
        return param;
    }


}
